package test;

import java.util.*;

public class Demo6 {

    static class StuRen {
        private int number;
        private int zhanDouLi;

        public StuRen(int number, int zhanDouLi) {
            this.number = number;
            this.zhanDouLi = zhanDouLi;
        }

        public int getNumber() {
            return number;
        }

        public void setNumber(int number) {
            this.number = number;
        }

        public int getZhanDouLi() {
            return zhanDouLi;
        }

        public void setZhanDouLi(int zhanDouLi) {
            this.zhanDouLi = zhanDouLi;
        }

        @Override
        public String toString() {
            return "StuRen{" +
                    "number=" + number +
                    ", zhanDouLi=" + zhanDouLi +
                    '}';
        }
    }

    public static void main(String[] args) {
        Scanner shuRu = new Scanner(System.in);
        while (shuRu.hasNext()) {

            String line = shuRu.nextLine();
            String[] s = line.split(" ");
            Deque<StuRen> list = new LinkedList<>();
            for (int i = 0; i < s.length; i++) {
                StuRen stuRen = new StuRen(i, Integer.parseInt(s[i]));
                list.add(stuRen);
            }
            StuRen ji = null;
            StuRen ya = null;
            int count = list.size() - 1;
            int cur = 0;
            boolean flag = list.size() % 2 == 0 ? true : false;
            while (list.size() > 1) {
                cur += 2;
                StuRen stuRenOne = list.removeFirst();
                StuRen stuRenTwo = list.removeFirst();
                StuRen shenLi = null;
                StuRen shibai = null;
                if (stuRenOne.getZhanDouLi() > stuRenTwo.getZhanDouLi()) {
                    shenLi = stuRenOne;
                    shibai = stuRenTwo;
                } else if (stuRenOne.getZhanDouLi() < stuRenTwo.getZhanDouLi()) {
                    shenLi = stuRenTwo;
                    shibai = stuRenOne;
                } else if (stuRenOne.getZhanDouLi() == stuRenTwo.getZhanDouLi()) {
                    if (stuRenOne.number > stuRenTwo.getNumber()) {
                        shenLi = stuRenTwo;
                        shibai = stuRenOne;
                    } else {
                        shenLi = stuRenOne;
                        shibai = stuRenTwo;
                    }
                }
                list.addLast(shenLi);

                if (list.size() == 2) {
                    ji = shibai;
                }
                if (list.size() == 1) {
                    ya = shibai;
                }

                if (!flag && count == cur) {
                    list.addLast(list.removeFirst());
                    flag = list.size() % 2 == 0 ? true : false;
                    count = list.size() - 1;
                    cur = 0;
                }

            }

            System.out.println(list.getFirst().number + " " + ya.number + " " + ji.number);


        }


    }
}
